package com.example.design_pattern.factory.simple;

import com.example.design_pattern.factory.Pizza;

/**
 *  pizza工厂，只负责生产Pizza
 *  静态工厂方法 不可以通过继承来改变创建方法的行为
 *  简单工厂不是设计模式，反而比较像一种编程习惯
 */
public class SimplePizzaFactory {

    public Pizza createPizza(PizzaTypeEnums type){
        Pizza pizza =null;
        switch (type) {
            case cheese:
                pizza = new CheesePizza();
                break;
            case pepperoni:
                pizza = new PepperoniPizza();
                break;
            case clam:
                pizza = new ClamPizza();
                break;
            case veggie:
                pizza = new VeggiePizza();
                break;
        }
        return pizza;
    }
}
